<?php
    session_start();
    require_once('includes/configuration.php');

    // Connect to Mullet database.
    $mul_db = mysql_connect($mConfig['mul_server'], $mConfig['mul_user'], $mConfig['mul_pass'])
            or die('Could not establish connection to Mullet database.');
    mysql_select_db($mConfig['mul_name'], $mul_db) or die('Could not select Mullet database.');

    // Connect to SMF database.
    $smf_db = mysql_connect($mConfig['smf_server'], $mConfig['smf_user'], $mConfig['smf_pass'])
            or die('Could not establish connection to SMF database.');
    mysql_select_db($mConfig['smf_name'], $smf_db) or die('Could not select SMF database.');

    // Include class files and functions.
    foreach($mConfig['includes'] as $file) require_once($file);

    header("Content-type: application/xml");
    echo '<?xml version="1.0"?>';
?>

<rss version="2.0">

<channel>
<title>Shinsei Events</title>
<description>Shinsei Guild Raid Calendar</description>
<link>http://www.shinsei-guild.org/mullet3</link>

<?
    $mullet = new mullet($mul_db, strtotime('yesterday'));
    $eventID_list = $mullet->getEventsByCreation(10);
    foreach ($eventID_list as $event_id) {
?>
<item>
<title><? echo $event->location; ?></title>
<description>
Raid: <? echo $event->location; ?><br />
When: <? echo date("D n/j/y", $event->start_time); ?>
</description>
<link>http://www.shinsei-guild.org/mullet3/viewevent.php?id=<? echo $event->eid; ?></link>
</item>
<?  } ?>
</channel>
</rss>
